package javax.mail.search;

import javax.mail.Address;
import javax.mail.internet.InternetAddress;

public abstract class AddressStringTerm extends StringTerm {
    protected boolean match(Address a) {
        if (a instanceof InternetAddress) {
            return super.match(((InternetAddress) a).toUnicodeString());
        }
        return super.match(a.toString());
    }

    public boolean equals(Object obj) {
        if (obj instanceof AddressStringTerm) {
            return super.equals(obj);
        }
        return false;
    }
}
